﻿@model IEnumerable<CmsContentTypeCategory>

@{
    ResFile = "cms_Content";
}
<div class="categories t-content-inner g-clear">
    <p>
        <a class="add-category b-button" href="@Url.Action("addcategory", "cmscontenttype")">@_("Add new")</a>        
    </p>    
	<fieldset class="b-form hide">
		<ol class="b-form__rows ul-reset g-clear">            	                        
        	<li class="b-form__row g-clear">
		        <label for="Category">@_("Category:")</label>
		        <input id="Category" class="category-name text" type="text" value="" /> 
                <input id="Id" class="category-id" name="Id" type="hidden" value="0" />
                <input class="category-action-url" type="hidden" />
		        <input class="save-category b-button b-button_small" type="submit" value="@_("Save")" />         		
                <a class="cancel-category b-button b-button_small b-button_colour_grey">@_("Cancel")</a>
        	</li>
        </ol>		
	</fieldset>
    @{Html.RenderPartial("ErrorPanel");}    
    @(Html.Telerik().Grid(Model).HtmlAttributes(new { style = "width:300px;" })
        .Name("ContentTypeCategoryGrid")
        .Columns(columns =>
                    {
                        columns.Bound(p => p.Category).Title(_("Category"));
                        columns.Template(
                            @<text>
                                <a href="@Url.Action("editcategory", "cmscontenttype", new { id = item.Id })" class="edit-category b-icon b-icon_edit" title="Edit">@_("Edit")</a>                                
                            </text>)
                        .ClientTemplate("<a href=" + Url.Action("editcategory", "cmscontenttype") + "/<#= Id#> class='edit-category b-icon b-icon_edit' title='" + _("Edit") + "'>" + _("Edit") + "</a>")
                        .Title("Edit");
                    })
        .DataBinding(dataBinding => dataBinding.Ajax().Select("_AllCategories", "cmscontenttype", new { id = @ViewBag.ContentTypeId }))
    )
</div>